<!DOCTYPE html>
<html lang="en">
<head>
    <title>管理系统 - 管理中心</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- <meta ng-include="'head.html'"> -->
    <style type="text/css">
        .btnOK{ height: 23px; padding: 0 10px; background: #f40; color: #fff; line-height: 23px; cursor: pointer; border: 0px; border-radius: 2px; background-clip: padding-box;
        }
       
        .lineInfo { height:50px }
        .lineInfo>label{font-weight: 100 }
        .titleHead { font-family: 宋体; font-size: 14px; font-weight: 400; margin-left: 15px }
        .mt20{ margin-top: 20px }
        .mt40{ margin-top: 40px }
        .mb30{margin-bottom:30px!important}
        .pHead{ color:#19B5FE }
        .content{ margin-left: 20px; font-size: 14px; font-family: arial; color:#1874CD }
        
    </style>
    <script src="../lib/js/jquery.min.js" type="text/javascript"></script>
    <script src="../js/build.js" type="text/javascript"></script>
    <script src="../js/public.js" type="text/javascript"></script>
</head>
<body class="flat-blue">
<div class="app-container H100" ng-app="myApp" ng-controller="myCtrl">
<div class="row content-container H100">
<div ng-include="'menus.html'" onload="loadReady()"></div>
<div class="container-fluid H100 pb15">
<div class="side-body padding-top H100" id="main" style="padding-top:70px">
    <!------------------Main---------------->
    <div class="H100" style="width:99%; background-color:#fff; position:relative; ">
        <div class="titleHead">➢个人资料</div>
        <!--基本信息-->
        <div class="panel panel-default mt20">
            <div class="panel-heading pHead">
                基本信息
            </div>
            <div class="panel-body">
                <div>
                    <div class="col-md-6 lineInfo"><label>用户名</label><label class="content">{{u.userName}}</label></div>
                    <div class="col-md-6 lineInfo"><label>注册时间</label><label class="content">{{u.registerTime}}</label></div>
                </div>
                <div>
                    <div class="col-md-6 lineInfo"><label>真实姓名</label><label class="content">{{u.realName}}</label></div>
                    <div class="col-md-6 lineInfo"><label>联系方式</label><label class="content">{{u.telephone}}</label></div>
                </div>
                <div>
                    <div class="col-md-6 lineInfo"><label>公司名称</label><label class="content"><a href="#" ng-click="goCompany(u.company)">{{u.company}}</a></label></div>
                    <div class="col-md-6 lineInfo"><label>上次登录</label><label class="content">{{u.logTime}}</label></div>
                </div>
            </div>
        </div>
        <!--账号信息-->
        <div class="panel panel-default mt20">
            <div class="panel-heading pHead">
                账号信息
            </div>
            <div class="panel-body">
                <div>
                    <div class="col-md-6 lineInfo"><label>账号级别</label><label style="color:{{u.color}}" class="content">{{u.levelText}}</label></div>
                    <div class="col-md-6 lineInfo"><label>账号状态</label><label class="content">{{u.status}}</label></div>
                </div>
            </div>
            <div class="panel-body">
                <div>
                    <div class="col-md-6 lineInfo"><label>到期时间</label><label class="content">{{u.deadline}}</label></div>
                    <div class="col-md-6 lineInfo"><label>剩余天数</label><label class="content">{{u.leftDay}}</label></div>
                </div>
            </div>
        </div>
        <!--公司信息-->
        <div class="panel panel-default mt20 mb30">
            <div class="panel-heading pHead">
                其它信息
            </div>
            <div class="panel-body">
                <div>
                    <div class="col-md-6 lineInfo">
                        <label>提交设备数</label><label class="content">{{u.countSubmit}}</label>
                    </div>
                    <div class="col-md-6 lineInfo">
                        <label title="可编辑设备数量">管理设备数</label><label class="content"><a href="#" ng-click="goDevice(u.userName)">{{u.countOwn}}</a></label>
                    </div>
                </div>
                <div>
                    <div class="col-md-6 lineInfo"><label></label></div>
                    <div class="col-md-6 lineInfo"><label></label></div>
                </div>
            </div>
        </div>


    </div>
    <!------------------End Main---------------------->
</div>  <!--End side-body-->
</div>  <!--End container-fluid-->
</div>  <!--End content-container-->
<div ng-include="'footer.html'"></div>
</div>  <!--End app-container-->

<script language="javascript">
    var app = angular.module('myApp', []);
    app.controller('myCtrl', function($scope) {
        loadCtlBase($scope);
        //// 用于他人访问
        $scope.user = getQueryString('u') || '';

        $scope.u = { };
        var info = ['userName', 'realName', 'company','level', 'telephone', 'status', 'deadline', 'registerTime', 'logTime'];
        var group = getGroups();
        $scope.groups = group.groups;
        $scope.levels = group.levels;
        function loadViews(id){
            ajaxData('get_user_info', {'userName':$scope.user}, function(rst){
                var data = rst.data;
                if(data.userName!=getCookie('username') && getCookie('level')<4){
                    alert("抱歉，您无权限查看该用户资料，可联系管理员！");
                    return;
                }

                $scope.u = data;
                $scope.u.status = $scope.u.status==1 ? "正常" : "限制登录";
                $scope.u.levelText = $scope.levels[$scope.u.level].name;
                $scope.u.color = $scope.levels[$scope.u.level].color;
                if($scope.u.deadline==null){
                    $scope.u.deadline = "永久有效";
                    $scope.u.leftDay = "无";
                }
                else{
                    $scope.u.deadline = "2018-03-30 21:11:31";
                    var times = new Date($scope.u.deadline).getTime() - new Date().getTime();
                    $scope.u.leftDay = (1.0 * times/(24*3600*1000)).toFixed(1) + " 天";
                }
                $scope.$apply();

            });
        }
        $scope.goCompany = function(company){
            window.location.href = "companyInfo.html?cp=" + escape(company);
        };

        $scope.goDevice = function(company){
            // window.location.href = "companyInfo.html?cp=" + escape(company);
        };


        loadViews();
    });



    
    
    $(document).ready(function(){
        // $("#fullH").heiht();

        /*
        $('.date').datetimepicker({
            format: 'yyyy-mm-dd', language:'zh-CN', autoclose:true, minView:"month"
        });
        */
    });


</script>

</body>
</html>
